{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "BIG DOG (10000, 10, 28)\n",
      "BIG DOG Test (1000, 10, 28)\n"
     ]
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "from iam_dataset import IamLinesDataset\n",
    "dataset = IamLinesDataset()\n",
    "dataset.load_or_generate_data()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(10000, 28, 280)"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataset.x_train.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7ff39ae27fd0>"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAkUAAABZCAYAAAAw9VAIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAGf9JREFUeJztnX2wVWW9xz8/ELAEU7HwBUU0stTyZcSXEMN8zwwth+xW6i1HLWnCsUYsp2tpjTbZnZzRZnQ0vca9ZKKpab6EhWi+EZ0EcUBSCYmXTBLE1PQ894+9v2udvTiLc/Z52Rv2+X5mnM3eZ5+1nvU8a3nW81m/3++JlBLGGGOMMQOdQc1ugDHGGGPM5oBviowxxhhj8E2RMcYYYwzgmyJjjDHGGMA3RcYYY4wxgG+KjDHGGGMA3xQZY4wxxgC9vCmKiBMiYnFELI2I6X3VKGOMMcaYRhM9Ld4YEYOBJcCxwEvAU8D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qv8/Oh3Yt/o711b/v2V6ztvAhSmlfYDDgPOr/ezroHGUjQH4OuiURpmiQ4ClKaXnU0pvATOByQ3at9mYycDN1X/fDJzSxLa0JCmlh4FXCh+X9ftk4H9ShceB7SJi58a0tHUpGYMyJgMzU0pvppReAJZS+f+W6SEppZUppfnVf68HngV2xddBw9jEGJQx4K+DRt0U7Qos7/D+JTY9MKbvSMADEfHHiDin+tmolNLK6r9XAaOa07QBR1m/+/poLFOrj2du7PDo2GPQj0TEHsCBwBP4OmgKhTEAXwed4kDr1ueIlNJBVNT0+RFxZMcfpkr6oVMQG4z7vWn8FNgLOABYCVzV3Oa0PhExHJgFTEsprev4M18HjaGTMfB1UEKjbopWALt1eD+6+pnpZ1JKK6qva4A7qKjQ1dLS1dc1zWvhgKKs3319NIiU0uqU0jsppXbgevJHAx6DfiAihlD5YzwjpXR79WNfBw2kszHwdVBOo26KngLGRcTYiBhKJZDrrgbte8ASEdtExAj9GzgOWEil78+sfu1M4M7mtHDAUdbvdwFnVLNvDgNe7fB4wfQhhRiVU6lcD1AZg9MjYlhEjKUS7Ptko9vXSkREADcAz6aUftzhR74OGkTZGPg6KGerRuwkpfR2REwF7gcGAzemlJ5pxL4HOKOAOyrXBVsB/5tSui8ingJujYgvA8uAKU1sY0sSEf8HTAJ2jIiXgP8CrqDzfr8X+ASVoMbXgf9seINbkJIxmBQRB1B5ZPMicC5ASumZiLgVWEQlY+f8lNI7zWh3CzEB+CKwICLaqp99C18HjaRsDD7n66BzXNHaGGOMMQYHWhtjjDHGAL4pMsYYY4wBfFNkjDHGGAP4psgYY4wxBvBNkTHGGGMM4JsiY4wxxhjAN0XGGGOMMYBviowxxhhjAPh/cq5stBUEwKMAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 1800x72 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize = (25, 1))\n",
    "offset = 9999\n",
    "plt.imshow(dataset.x_train[offset], cmap='gray', interpolation='none')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(7101, 97, 80)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataset.y_train.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[18  4 13  8 14 17 27 27 27 27]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "'senior____'"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def convert_y_label_to_string(y, dataset=dataset):\n",
    "    return ''.join([dataset.mapping[i] for i in np.argmax(y, axis=-1)])\n",
    "\n",
    "print(np.argmax(dataset.y_train[offset], axis=-1))\n",
    "convert_y_label_to_string(dataset.y_train[offset])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
